package com.foreknow.demo8;

public class TestSingle {

    public static void main(String[] args) {
        SingleDemo single = SingleDemo.getInstance();
        single.setName("tom");
        System.out.println(single.getName());

        SingleDemo single1 = SingleDemo.getInstance();
        System.out.println(single.getName()); //还是"tom"(返回的是同一个instance)


    }
}




